/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import org.junit.Test;

/**
 * <p>Project: javaseapp - T1
 * <p>Powered by webrx On 2021-08-31 08:42:18
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 16
 */
public class T1 {
    //值类型，成员
    record Order(int id, String name, double money) {
    }

    @Test
    public void m1() {
        System.out.println("Hello World");
        System.out.println(System.getProperty("java.home"));
        System.out.println(System.getProperty("java.version"));
        System.out.println(System.getProperty("os.name"));
    }

    @Test
    public void m2() {
        //record 值类型
        Teacher t = new Teacher(1, "李四", 18, 2000, "郑州市");
        System.out.println(t.money());
        var t2 = new Teacher(2, "赵强", 16, 6000, "北京市");
        System.out.println(t);
        System.out.println(t.name());
        System.out.println(t.pf(19));

        Order od = new Order(1, "李四20210831", 670);
        System.out.println(new Order(1, "李四20210831", 670));
        System.out.println(od);
        System.out.println(od.id());
        System.out.println(od.money);
        System.out.println(od.money());

        record User(int id, String name) {
        }

        var u = new User(10, "jack");
        User u2 = new User(22, "李四");
        System.out.println(u);
        System.out.println(u2);
    }

    @Test
    public void m3() {
        //record
        System.out.println(new Teacher());
        System.out.println(new Teacher(1, "王强"));

        System.out.println(new Teacher(101));

        System.out.println(new Teacher());
    }

    public static void main(String[] args) {

    }

    @Test
    public void m4() {
        record R1(int id, String name, double money) {
            public R1 {

            }

            public R1() {
                this(1, "a", 30);
            }


            public R1(int id, String name) {
                this(id, name, 50);
            }
        }
    }
}
